<template>
	<view class="container">
		<TopNav title="简介"></TopNav>
		<view class="bg-white radius p-lr16 p-t13 p-b12">
			<view class="">
				<text class="f-w600 f-s15 line-height22">内容</text>
			</view>
			<view class="m-t12">
				<u-textarea v-model="form.content" placeholder="请输入简介内容" count border="none" height="250rpx"
					placeholderClass="textarea-placeholder" maxlength="100" style="color:#202020;"></u-textarea>
			</view>
		</view>
		<view class="fixed-bottom bg-white p-lr16">
			<view class="self-btn full-width m-t6" hover-class="pressed" @click="handleSubmit">
				<text>提交</text>
			</view>
		</view>
		<Toast></Toast>
	</view>
</template>

<script>
	import {
		resume
	} from '@/api/mine/setting.js'
	import {
		getInfo
	} from '@/api/login';
	export default {
		components:{},
		data() {
			return {
				form: {
					content: ''
				}
			};
		},
		onLoad() {
			this.getDetail()
		},
		methods: {
			getDetail() {
				getInfo().then(res => {
					let {
						data: {
							info
						}
					} = res
					this.form.content = info?.introduction ?? ''
				})
			},
			handleSubmit() {
				if (!this.form.content) {
					this.$toast("请输入简介内容")
					return
				}
				this.$modal.loading('上传中').then(() => {
					resume(this.form).then(res => {
						this.$toast(res.msg)
						this.$modal.closeLoading()
					}).catch(() => this.$modal.closeLoading())
				})
		
			}
		}
	}
</script>

<style scoped lang="scss">
	@import '@/common/css/var.scss';

	page {
		@include fixed-bottom;
	}

	.container {
		padding: 20rpx 24rpx;
	}
</style>
